package cn.edu.gduf.luowowo.common.util;

import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@Setter
@Getter
@NoArgsConstructor
public class AjaxResult {
    private boolean success; //请求成功与否
    private String msg; //返回的信息
    private Object data; //返回的对象信息
    private int code;

    public AjaxResult(boolean success) {
        this.success = success;
    }
    public AjaxResult(boolean success, String msg) {
        this.success = success;
        this.msg = msg;
    }

    //成功
    public static  final AjaxResult SUCCESS = new AjaxResult(true);
    //失败
    public static  final AjaxResult FAIL = new AjaxResult(false);

    public AjaxResult addData(Object data){
        this.data = data;
        return this;
    }
}
